<template>
	<div class="llf_content">
		<SearchHeader @search="onSearch" :selectform="selectform" placeholder="患者姓名,项目名称搜索" :isDate="{ bol:true, title:'' }">
			<template v-slot:rightBtn>
				<MyButton class="primary" @click="onPrint" title="打印" />
				<MyButton class="delete" @click="TableOperation('delete')" title="删除" />
			</template>
		</SearchHeader>
		<ReportList :tableData="dataSource" @operation="TableOperation" ref="reportRef" />
		<MyPagination :total="total" @change="onPaginationChange" />
	</div>
</template>

<script lang="ts" setup>
	import { onMounted, ref } from "vue";
	import { Modal } from 'ant-design-vue';
	import { getList } from "@/api/patient";
	import options from "@/common";
	import message from "@/utils/message";
	import ReportList from "./component/ReportList.vue";
	
	const selectform = ref<any>([
		{ title: '状态', childer:[], width: '50px', contWidth: '150px',class: 'status', },
		{ title: '审核状态', childer: options.SEX_OPTIONS, width: '50px',class: 'check' },
	]);
	const dataSource = ref([{name:'s',id:1}]);
	const reportRef = ref();
	const total = ref(0);
	const sreach = ref({});
	
	async function getFn(){
		// const res = await getList();
		// if(!res) return;
		// dataSource.value = res;
	}
	
	const onSearch = (inputValue: string, obj: any) => {	//搜索---子组件
		let SEARCH_VALUE = {};
		SEARCH_VALUE = obj;
		SEARCH_VALUE["content"] = inputValue;
		console.log(SEARCH_VALUE, "SEARCH_VALUE")
		// searchData.value.page = 1;
		// pageRef.value.changeCurrent();
		// searchData.value = { ...searchData.value, ...SEARCH_VALUE };
		// onGetPatientList();
	};
	
	const onPaginationChange = (value: { page: number; pageSize: number }) => { // 页码与页面数量
		const { pageSize, page } = value;
		// searchData.value = { ...searchData.value, page, limit: pageSize };
		// onGetPatientList();
	};
	
	const onPrint = ()=>{
		console.log('onPrint');
	};
	
	function delFn(row){
		Modal.confirm({
		    content: `您确定要永久删除吗？`,
		    onOk() {
		       console.log(2);
		    },
		    // eslint-disable-next-line @typescript-eslint/no-empty-function
		    onCancel() {},
		});
	}
	
	const TableOperation = async (index: string, row: any = {}) => { // 表格操作
		switch(index){
			case 'look':{
				
			};break;
			case 'delete':{
				if(reportRef.value.selectedRowsval.length == 0 && !row.id) return message.error('请先选择需要删除的数据');
				delFn(1);
				console.log()
			};break;
			default:console.log(1);
		}
	}
	
	onMounted(()=>{
		getFn();
	});
</script>

<style>
</style>